Most end users don't care about whether a tag comes from MediaWiki core
or an extension. Since we now have tags that are added by core, let's
rename all of the "extension" terminology to the more generic
"software".
Not renamed in this patch is the i18n message "tags-source-extension",
which will be done in a separate patch to coordinate with TWN, and the
"source" output of the API, to avoid a breaking change.
Change-Id: Ic7b32b3e4bef0c0153a7cf302eef4aa07c52c9f2
$limit = $params['limit'];
$result = $this->getResult();
$limit = $params['limit'];
$result = $this->getResult();
- $extensionDefinedTags = array_fill_keys( ChangeTags::listExtensionDefinedTags(), 0 );
+ $softwareDefinedTags = array_fill_keys( ChangeTags::listSoftwareDefinedTags(), 0 );
$explicitlyDefinedTags = array_fill_keys( ChangeTags::listExplicitlyDefinedTags(), 0 );
$explicitlyDefinedTags = array_fill_keys( ChangeTags::listExplicitlyDefinedTags(), 0 );
- $extensionActivatedTags = array_fill_keys( ChangeTags::listExtensionActivatedTags(), 0 );
+ $softwareActivatedTags = array_fill_keys( ChangeTags::listSoftwareActivatedTags(), 0 );
- $definedTags = array_merge( $extensionDefinedTags, $explicitlyDefinedTags );
+ $definedTags = array_merge( $softwareDefinedTags, $explicitlyDefinedTags );
# Fetch defined tags that aren't past the continuation
if ( $params['continue'] !== null ) {
# Fetch defined tags that aren't past the continuation
if ( $params['continue'] !== null ) {
$tag['hitcount'] = $hitcount;
}
$tag['hitcount'] = $hitcount;
}
- $isExtension = isset( $extensionDefinedTags[$tagName] );
+ $isSoftware = isset( $softwareDefinedTags[$tagName] );
$isExplicit = isset( $explicitlyDefinedTags[$tagName] );
if ( $fld_defined ) {
$isExplicit = isset( $explicitlyDefinedTags[$tagName] );
if ( $fld_defined ) {
- $tag['defined'] = $isExtension || $isExplicit;
+ $tag['defined'] = $isSoftware || $isExplicit;
}
if ( $fld_source ) {
$tag['source'] = [];
}
if ( $fld_source ) {
$tag['source'] = [];
+ if ( $isSoftware ) {
+ // TODO: Can we change this to 'software'?
$tag['source'][] = 'extension';
}
if ( $isExplicit ) {
$tag['source'][] = 'extension';
}
if ( $isExplicit ) {
- $tag['active'] = $isExplicit || isset( $extensionActivatedTags[$tagName] );
+ $tag['active'] = $isExplicit || isset( $softwareActivatedTags[$tagName] );
}
$fit = $result->addValue( [ 'query', $this->getModuleName() ], null, $tag );
}
$fit = $result->addValue( [ 'query', $this->getModuleName() ], null, $tag );
// to be removed, a tag must not be defined by an extension, or equivalently it
// has to be either explicitly defined or not defined at all
// (assuming no edge case of a tag both explicitly-defined and extension-defined)
// to be removed, a tag must not be defined by an extension, or equivalently it
// has to be either explicitly defined or not defined at all
// (assuming no edge case of a tag both explicitly-defined and extension-defined)
- $extensionDefinedTags = self::listExtensionDefinedTags();
- $intersect = array_intersect( $tagsToRemove, $extensionDefinedTags );
+ $softwareDefinedTags = self::listSoftwareDefinedTags();
+ $intersect = array_intersect( $tagsToRemove, $softwareDefinedTags );
if ( $intersect ) {
return self::restrictedTagError( 'tags-update-remove-not-allowed-one',
'tags-update-remove-not-allowed-multi', $intersect );
if ( $intersect ) {
return self::restrictedTagError( 'tags-update-remove-not-allowed-one',
'tags-update-remove-not-allowed-multi', $intersect );
return Status::newFatal( 'tags-delete-too-many-uses', $tag, self::MAX_DELETE_USES );
}
return Status::newFatal( 'tags-delete-too-many-uses', $tag, self::MAX_DELETE_USES );
}
- $extensionDefined = self::listExtensionDefinedTags();
- if ( in_array( $tag, $extensionDefined ) ) {
+ $softwareDefined = self::listSoftwareDefinedTags();
+ if ( in_array( $tag, $softwareDefined ) ) {
// extension-defined tags can't be deleted unless the extension
// specifically allows it
$status = Status::newFatal( 'tags-delete-not-allowed' );
// extension-defined tags can't be deleted unless the extension
// specifically allows it
$status = Status::newFatal( 'tags-delete-not-allowed' );
* @return array
* @since 1.25
*/
* @return array
* @since 1.25
*/
- public static function listExtensionActivatedTags() {
+ public static function listSoftwareActivatedTags() {
// core active tags
$tags = self::$coreTags;
if ( !Hooks::isRegistered( 'ChangeTagsListActive' ) ) {
// core active tags
$tags = self::$coreTags;
if ( !Hooks::isRegistered( 'ChangeTagsListActive' ) ) {
+ /**
+ * @see listSoftwareActivatedTags
+ * @deprecated since 1.28 call listSoftwareActivatedTags directly
+ * @return array
+ */
+ public static function listExtensionActivatedTags() {
+ wfDeprecated( __METHOD__, '1.28' );
+ return self::listSoftwareActivatedTags();
+ }
+
/**
* Basically lists defined tags which count even if they aren't applied to anything.
* It returns a union of the results of listExplicitlyDefinedTags() and
/**
* Basically lists defined tags which count even if they aren't applied to anything.
* It returns a union of the results of listExplicitlyDefinedTags() and
*/
public static function listDefinedTags() {
$tags1 = self::listExplicitlyDefinedTags();
*/
public static function listDefinedTags() {
$tags1 = self::listExplicitlyDefinedTags();
- $tags2 = self::listExtensionDefinedTags();
+ $tags2 = self::listSoftwareDefinedTags();
return array_values( array_unique( array_merge( $tags1, $tags2 ) ) );
}
return array_values( array_unique( array_merge( $tags1, $tags2 ) ) );
}
* @return string[] Array of strings: tags
* @since 1.25
*/
* @return string[] Array of strings: tags
* @since 1.25
*/
- public static function listExtensionDefinedTags() {
+ public static function listSoftwareDefinedTags() {
// core defined tags
$tags = self::$coreTags;
if ( !Hooks::isRegistered( 'ListDefinedTags' ) ) {
// core defined tags
$tags = self::$coreTags;
if ( !Hooks::isRegistered( 'ListDefinedTags' ) ) {
+ /**
+ * Call listSoftwareDefinedTags directly
+ *
+ * @see listSoftwareDefinedTags
+ * @deprecated since 1.28
+ */
+ public static function listExtensionDefinedTags() {
+ wfDeprecated( __METHOD__, '1.28' );
+ return self::listSoftwareDefinedTags();
+ }
+
/**
* Invalidates the short-term cache of defined tags used by the
* list*DefinedTags functions, as well as the tag statistics cache.
/**
* Invalidates the short-term cache of defined tags used by the
* list*DefinedTags functions, as well as the tag statistics cache.
protected $explicitlyDefinedTags;
/**
protected $explicitlyDefinedTags;
/**
- * @var array List of extension defined tags
+ * @var array List of software defined tags
- protected $extensionDefinedTags;
+ protected $softwareDefinedTags;
- * @var array List of extension activated tags
+ * @var array List of software activated tags
- protected $extensionActivatedTags;
+ protected $softwareActivatedTags;
function __construct() {
parent::__construct( 'Tags' );
function __construct() {
parent::__construct( 'Tags' );
// Used in #doTagRow()
$this->explicitlyDefinedTags = array_fill_keys(
ChangeTags::listExplicitlyDefinedTags(), true );
// Used in #doTagRow()
$this->explicitlyDefinedTags = array_fill_keys(
ChangeTags::listExplicitlyDefinedTags(), true );
- $this->extensionDefinedTags = array_fill_keys(
- ChangeTags::listExtensionDefinedTags(), true );
+ $this->softwareDefinedTags = array_fill_keys(
+ ChangeTags::listSoftwareDefinedTags(), true );
// List all defined tags, even if they were never applied
// List all defined tags, even if they were never applied
- $definedTags = array_keys( $this->explicitlyDefinedTags + $this->extensionDefinedTags );
+ $definedTags = array_keys( $this->explicitlyDefinedTags + $this->softwareDefinedTags );
// Show header only if there exists atleast one tag
if ( !$tagStats && !$definedTags ) {
// Show header only if there exists atleast one tag
if ( !$tagStats && !$definedTags ) {
);
// Used in #doTagRow()
);
// Used in #doTagRow()
- $this->extensionActivatedTags = array_fill_keys(
- ChangeTags::listExtensionActivatedTags(), true );
+ $this->softwareActivatedTags = array_fill_keys(
+ ChangeTags::listSoftwareActivatedTags(), true );
// Insert tags that have been applied at least once
foreach ( $tagStats as $tag => $hitcount ) {
// Insert tags that have been applied at least once
foreach ( $tagStats as $tag => $hitcount ) {
$newRow .= Xml::tags( 'td', null, $desc );
$sourceMsgs = [];
$newRow .= Xml::tags( 'td', null, $desc );
$sourceMsgs = [];
- $isExtension = isset( $this->extensionDefinedTags[$tag] );
+ $isSoftware = isset( $this->softwareDefinedTags[$tag] );
$isExplicit = isset( $this->explicitlyDefinedTags[$tag] );
$isExplicit = isset( $this->explicitlyDefinedTags[$tag] );
+ if ( $isSoftware ) {
+ // TODO: Rename this message
$sourceMsgs[] = $this->msg( 'tags-source-extension' )->escaped();
}
if ( $isExplicit ) {
$sourceMsgs[] = $this->msg( 'tags-source-extension' )->escaped();
}
if ( $isExplicit ) {
}
$newRow .= Xml::tags( 'td', null, implode( Xml::element( 'br' ), $sourceMsgs ) );
}
$newRow .= Xml::tags( 'td', null, implode( Xml::element( 'br' ), $sourceMsgs ) );
- $isActive = $isExplicit || isset( $this->extensionActivatedTags[$tag] );
+ $isActive = $isExplicit || isset( $this->softwareActivatedTags[$tag] );
$activeMsg = ( $isActive ? 'tags-active-yes' : 'tags-active-no' );
$newRow .= Xml::tags( 'td', null, $this->msg( $activeMsg )->escaped() );
$activeMsg = ( $isActive ? 'tags-active-yes' : 'tags-active-no' );
$newRow .= Xml::tags( 'td', null, $this->msg( $activeMsg )->escaped() );
$preText .= $this->msg( 'tags-delete-explanation-warning', $tag )->parseAsBlock();
// see if the tag is in use
$preText .= $this->msg( 'tags-delete-explanation-warning', $tag )->parseAsBlock();
// see if the tag is in use
- $this->extensionActivatedTags = array_fill_keys(
- ChangeTags::listExtensionActivatedTags(), true );
- if ( isset( $this->extensionActivatedTags[$tag] ) ) {
+ $this->softwareActivatedTags = array_fill_keys(
+ ChangeTags::listSoftwareActivatedTags(), true );
+ if ( isset( $this->softwareActivatedTags[$tag] ) ) {
$preText .= $this->msg( 'tags-delete-explanation-active', $tag )->parseAsBlock();
}
$preText .= $this->msg( 'tags-delete-explanation-active', $tag )->parseAsBlock();
}